package main

import (
	"errors"
)

func main() {
	res := testError("zhaengsan")
	if res != nil {
		//程序自定抛出错误
		panic(res)
	}
}

func testError(name string) error {
	if name == "zhangsan" {
		return nil
	} else {
		return errors.New("参数错误")
	}
}
